<template>
    <div v-if="loading" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.8)" element-loading-spinner="el-icon-loading" element-loading-text="正在初始化" style="height: 100vh"></div>
    <TopoRender v-else :defaultValue="selectedValue" :isShare="isShare" />
</template>

<script>
import TopoRender from '../components/screen/TopoRender';
import request from '@/utils/request';

export default {
    name: 'TopoFullscreen',
    components: {
        TopoRender,
    },
    data() {
        return {
            selectedValue: 100,
            loading: true,
            isShare: false,
        };
    },
    methods: {
        getToken() {
            let url = '/ignoreToken/getTokenByGuid';
            let query = {
                ztGuid: this.$store.state.app.guid ? this.$store.state.app.guid : this.$route.query.guid,
                token: sessionStorage.getItem('Admin-Token-WebTopo') == 'undefined' ? '' : sessionStorage.getItem('Admin-Token-WebTopo'),
            };
            request({
                url: url,
                method: 'get',
                params: query,
            })
                .then((res) => {
                    // console.log("token获取成功",res.data);
                    sessionStorage.setItem('Admin-Token-WebTopo', res.data);
                    this.loading = false;
                })
                .catch((err) => {
                    // console.log("获取token失败");
                });
        },
    },
    created() {
        if (this.$route.query.isShare) {
            this.isShare = true;
        }
        if (this.$store.state.app.guid ? this.$store.state.app.guid : this.$route.query.guid) {
            // this.getToken();
            this.loading = false;
        } else {
            this.loading = false;
        }
    },
    mounted() {},
};
</script>

<style scoped></style>
